void stronglyConnectedComponents(vector< vector<bool> > &map, vector< vector<int> > &answer) {
	vector<bool> visited(map.size(), false);
	vector<int> reversePostOrder;
	for (int i = 0; i != map.size(); ++i) {
		if (!visited[i])
			dfsFirst(map, i, reversePostOrder, visited);
	}
	visited = vector<bool>(map.size(), false);
	for (int i : reversePostOrder) {
		if (!visited[i]) {
			vector<int> component;
			dfsSecond(map, i, component, visited);
			answer.push_back(component);
		}
	}
}
void dfsFirst(vector< vector<bool> > &map, int cur, vector<int> &reversePostOrder, vector<bool> &visited) {
	visited[cur] = true;
	for (int next = 0; next != map.size(); ++next) {
		if (map[cur][next] && !visited[next])
			dfsFirst(map, next, reversePostOrder, visited);
	}
	reversePostOrder.push_back(cur);
}
void dfsSecond(vector< vector<bool> > &map, int cur, vector<int> &component, vector<bool> &visited) {
	visited[cur] = true;
	component.push_back(cur);
	for (int i = 0; i != map.size(); ++i) {
		if (map[cur][i] && !visited[i])
			dfsSecond(map, i, component, visited);
	}
}